![]() |
PATH![]() |
When you are running a Macintosh embedding application, you must explicitly tell JManager to give up time to the Java virtual machine. You do so by using the
JMIdle
function
JMIdle
in your main event loop.
Listing 1-3 shows an example of using
JMIdle
.
Listing 1-3 Using the JMIdle function
Boolean MainEventLoopContinues = true;
while (MainEventLoopContinues) {
EventRecord eve;
if (! WaitNextEvent(everyEvent, &eve, 30, nil) ||
eve.what == nullEvent)
JMIdle(theSession, 100);
else
handleEvent(&eve);
}
The value specified in JMIdle indicates how many milliseconds to allot to other threads; you can specify a default wait period by using the value kDefaultJMTime . JMIdle returns immediately if no threads need servicing. JMIdle also returns if a user event occurs in the current session.